<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>后盾人</title>
  </head>
  <body></body>
  <script>
    //原型的继承，而不是改变构造函数的原型
    function User() {}
    User.prototype.name = function() {
      console.log("user.name");
    };
    // let hd = new User();
    // hd.name();

    function Admin() {}
    Admin.prototype = User.prototype;
    Admin.prototype.role = function() {
      console.log("admin.role");
    };

    function Member() {}
    Member.prototype = User.prototype;
    Member.prototype.role = function() {
      console.log("member.role");
    };

    let a = new Admin();
    a.role();
  </script>
</html>
